package com.nulldev.util.data.tests.cachedItem;

import com.nulldev.util.JVM.Arguments;
import com.nulldev.util.JVM.JVM;
import com.nulldev.util.data.CachedItem;

public class CachedItemManualTest {

	public static void main(String[] args) {
		Arguments.setup(args);
		JVM.println("=> Creating CI...");
		final CachedItem<String> str = new CachedItem<String>("TEST", 0, true) {

			@Override
			public String accquire() throws Exception {
				return "Hello world!";
			}
		};
		JVM.println("-> waitFor(): " + str.waitFor());
		JVM.println("=> Invoking reaccquire()");
		final String x = str.reaccquire();
		JVM.println("-> reaccquire(): " + x);
		JVM.println("Overriding object...");
		str.set("My cached item now :)");
		JVM.println("-> [overriden] waitFor(): " + str.waitFor());
		JVM.println("-> reaccquire(): " + str.reaccquire());
	}
}
